package com.element.security.utils;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @auther zhangwj
 * @date 2021/4/13 上午11:05
 */
public class ResponseUtil {

    public static <T> void writeJson(HttpServletResponse response, T data) throws IOException {
        response.setContentType("application/json");
        response.setCharacterEncoding("utf-8");
        response.getWriter().println(data);
        response.getWriter().flush();
        response.getWriter().close();
    }
}
